<template>
  <div id="fexbox">
    <div id="nav">
      <router-link to="/" tag="a">
        <van-icon name="wap-home" size="20px" />首页
      </router-link>
      <router-link to="/product" tag="a">
        <van-icon name="wap-nav" size="20px" />分类
      </router-link>
      <router-link to="/cart" tag="a">
        <van-icon
          name="shopping-cart"
          size="20px"
          :badge="this.$store.state.cartnum >0 ? this.$store.state.cartnum : null"
        />购物车
      </router-link>
      <router-link to="/my" tag="a">
        <van-icon name="manager" size="20px" />我的易果
      </router-link>
    </div>
  </div>
</template>
<script>
export default {
  created() {
    this.$store.dispatch("cartnum");
  }
};
</script>
<style lang="scss" scoped>
#fexbox {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 1000;
}
#nav {
  border-top: solid 0.0625rem #ccc;
  background-color: #ffffff;
  height: 4.17rem;
  width: 100%;
  display: flex;
  text-align: center;
  z-index: 100;
  .van-info {
    right: 30px;
  }
  a {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 11px;
    text-decoration: none;
    color: #8d8a8a;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>